import { defineStore } from "pinia"

export const useCountStore = defineStore("count", {
  actions: {
    jia(value: number) {
      if (this.sum < 10) {
        this.sum += value
      }
    }
  },
  //真正存储数据的地方
  state() {
    return {
      sum: 6,
      subject: "Math"
    }
  },
  getters: {
    enlargeSum(state) {
      return state.sum * 10
    },
    changeSubject(): string {
      return this.subject.toUpperCase()
    }
  }
})